package com.learning.cloud2020.client;

import com.learning.cloud2020.Constance;
import com.learning.cloud2020.entities.Payment;
import com.learning.cloud2020.model.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/payment")
@FeignClient(name = Constance.PAYMENT_SERVER_NAME)
public interface PaymentFeignClient {

    @PostMapping("/create")
    CommonResult create(@RequestBody Payment payment);

    @GetMapping("/{id}")
    CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);

    @GetMapping("/timeout/{sleepMillis}")
    CommonResult<Payment> getPaymentByIdTimeOut(@PathVariable("sleepMillis") Long sleepMillis);

    @GetMapping("/discovery")
    Object discovery();

}
